package ru.dartit.android.apps.ucabinet.api;

import ru.dartit.android.apps.ucabinet.io.HttpsConnector;

import javax.net.ssl.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;

/**
 * @author gradusnik
 */

public class ApiUcabinet {

  public static final String TAG = ApiUcabinet.class.getSimpleName();

  public static String auth(String login, String password, boolean save) throws IOException {
    Map<String,String> params = new HashMap<String, String>();
    params.put("a","auth");
    params.put("login",login);
    params.put("password",password);
    if (save) {
      params.put("save", "1");
    }

    return HttpsConnector.readUrl(params);
  }
}